package com.wtwd.device.service.impl;


import com.wtwd.device.dao.AppUserTotalMapper;
import com.wtwd.device.model.entity.AppUserTotal;
import com.wtwd.device.service.AppUserTotalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author mjy
 * @date 2021/10/20
 * @description
 */
@Service
public class AppUserTotalServiceImpl implements AppUserTotalService {

    @Autowired
    private AppUserTotalMapper appUserTotalMapper;

    @Override
    public AppUserTotal getAppUserTotalByUserId(Long userId) {
        return appUserTotalMapper.getAppUserTotalByUserId(userId);
    }

    @Override
    public Integer insert(AppUserTotal appUserTotal) {
        return appUserTotalMapper.insert(appUserTotal);
    }

    @Override
    public Integer updateStepTotal(Long userId, Integer stepTotal) {
        return appUserTotalMapper.updateStepTotal(userId,stepTotal);
    }

    @Override
    public Integer updateCaloriesTotal(Long userId, Integer caloriesTotal) {
        return appUserTotalMapper.updateCaloriesTotal(userId,caloriesTotal);
    }

    @Override
    public Integer updateRunTotal(Long userId, Integer runTotal) {
        return appUserTotalMapper.updateRunTotal(userId,runTotal);
    }

    @Override
    public Integer updateRidingTotal(Long userId, Integer ridingTotal) {
        return appUserTotalMapper.updateRidingTotal(userId,ridingTotal);
    }

    @Override
    public boolean deleteByUserId(Long userId) {
        return appUserTotalMapper.deleteByUser(userId)==1;
    }
}
